using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class LocationCharacteristicIDAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public LocationCharacteristicIDAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v23] = HL7TableType.User;
						tableVersionTypes[HL7Version.v231] = HL7TableType.User;
						tableVersionTypes[HL7Version.v24] = HL7TableType.User;
						tableVersionTypes[HL7Version.v25] = HL7TableType.User;
						tableVersionTypes[HL7Version.v251] = HL7TableType.User;
						tableVersionTypes[HL7Version.v26] = HL7TableType.User;
						tableVersionTypes[HL7Version.v27] = HL7TableType.User;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v23] = new string[]{"GEN","IMP","INF","LCR","LIC","OVR","PRL","SET","SHA","SMK","STF","TEA"};
						validVersionCodes[HL7Version.v231] = new string[]{"SMK","LIC","IMP","SHA","INF","PRL","LCR","OVR","STF","SET","GEN","TEA"};
						validVersionCodes[HL7Version.v24] = new string[]{"SMK","LIC","IMP","SHA","INF","PRL","LCR","OVR","STF","SET","GEN","TEA"};
						validVersionCodes[HL7Version.v25] = new string[]{"SMK","LIC","IMP","SHA","INF","PRL","LCR","OVR","STF","SET","GEN","TEA"};
						validVersionCodes[HL7Version.v251] = new string[]{"SMK","LIC","IMP","SHA","INF","PRL","LCR","OVR","STF","SET","GEN","TEA"};
						validVersionCodes[HL7Version.v26] = new string[]{"SMK","LIC","IMP","SHA","INF","PRL","LCR","OVR","STF","SET","GEN","TEA"};
						validVersionCodes[HL7Version.v27] = new string[]{"SMK","LIC","IMP","SHA","INF","PRL","LCR","OVR","STF","SET","GEN","TEA"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v23] = new string[]{"Gender of patient(s)","Implant: can be used for radiation implant patients","Infectious disease:  this location can be used for isolation","Level of care","Licensed","Overflow","Private Level:  indicating a level of private versus non-private room","Bed is set up","Shadow:  a temporary holding location that does not physically exist","Smoking","Bed is staffed","Teaching location"};
						validVersionDescriptions[HL7Version.v231] = new string[]{"Smoking","Licensed","Implant: can be used for radiation implant patients","Shadow: a temporary holding location that does not physically exist","Infectious disease: this location can be used for isolation","Privacy level: indicating the level of private versus non-private room","Level of care","Overflow","Bed is staffed","Bed is set up","Gender of patient(s)","Teaching location"};
						validVersionDescriptions[HL7Version.v24] = new string[]{"Smoking","Licensed","Implant: can be used for radiation implant patients","Shadow: a temporary holding location that does not physically exist","Infectious disease: this location can be used for isolation","Privacy level: indicating the level of private versus non-private room","Level of care","Overflow","Bed is staffed","Bed is set up","Gender of patient(s)","Teaching location"};
						validVersionDescriptions[HL7Version.v25] = new string[]{"Smoking","Licensed","Implant: can be used for radiation implant patients","Shadow: a temporary holding location that does not physically exist","Infectious disease: this location can be used for isolation","Privacy level: indicating the level of private versus non-private room","Level of care","Overflow","Bed is staffed","Bed is set up","Gender of patient(s)","Teaching location"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"Smoking","Licensed","Implant: can be used for radiation implant patients","Shadow: a temporary holding location that does not physically exist","Infectious disease: this location can be used for isolation","Privacy level: indicating the level of private versus non-private room","Level of care","Overflow","Bed is staffed","Bed is set up","Gender of patient(s)","Teaching location"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"Smoking","Licensed","Implant: can be used for radiation implant patients","Shadow: a temporary holding location that does not physically exist","Infectious disease: this location can be used for isolation","Privacy level: indicating the level of private versus non-private room","Level of care","Overflow","Bed is staffed","Bed is set up","Gender of patient(s)","Teaching location"};
						validVersionDescriptions[HL7Version.v27] = new string[]{"Smoking","Licensed","Implant: can be used for radiation implant patients","Shadow: a temporary holding location that does not physically exist","Infectious disease: this location can be used for isolation","Privacy level: indicating the level of private versus non-private room","Level of care","Overflow","Bed is staffed","Bed is set up","Gender of patient(s)","Teaching location"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
